package com.kly.user.db.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.log.factory.LogFactory;
import com.fqgj.log.interfaces.Log;
import com.kly.user.db.dao.UserWlmLogDao;
import com.kly.user.db.entity.UserWlmEntity;
import com.kly.user.db.entity.UserWlmLogEntity;
import com.kly.user.serviceImpl.WlmServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.stereotype.Repository;

/**
* User: yujianfu
* Date: 2023-08-18
* Time: 10:55:54.568
*/

@Repository
public class UserWlmLogDaoImpl extends AbstractBaseMapper<UserWlmLogEntity> implements UserWlmLogDao {

    private static Log logger = LogFactory.getLog(UserWlmLogDaoImpl.class);


    @Override
    public UserWlmLogEntity addWlmLog(UserWlmEntity userWlmEntity) {
        try {
            UserWlmLogEntity userWlmLogEntity = new UserWlmLogEntity();
            BeanUtils.copyProperties(userWlmEntity, userWlmLogEntity);
            return this.insert(userWlmLogEntity);
        } catch (Exception e) {
            logger.error("addWlmLogFailed, parameter:{}", JSONObject.toJSONString(userWlmEntity));
            return null;
        }
    }

    @Override
    public Integer removeData() {
        return this.getSqlSession().delete(this.getStatement("removeData"));
    }
}